package com.whmall.service.crm.module.companyuser.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.whmall.service.crm.module.companyuser.entity.CompanyUserDO;
import com.whmall.service.crm.module.companyuser.entity.qo.CompanyUserQO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 公司用户Mapper
 *
 * @author alex
 * @since 2020/7/31
 */
@Mapper
public interface CompanyUserMapper extends BaseMapper<CompanyUserDO> {

    int insertSelective(CompanyUserDO record);

    CompanyUserDO getById(Long id);

    int updateByIdSelective(CompanyUserDO record);

    List<CompanyUserDO> listByCompanyId(Long companyId);

    CompanyUserDO getDefaultByCompanyId(Long companyId);

    List<CompanyUserDO> listBy(CompanyUserQO qo);

    List<CompanyUserDO> listByIds(List<Long> ids);

    List<CompanyUserDO> listByCompanyIdsAndDefaultIsTrue(@Param("companyIds") List<Long> companyIds);

    List<CompanyUserDO> listByCompanyIds(@Param("list") List<Long> list);

    int countByCompanyId(@Param("companyId") Long companyId);

    CompanyUserDO findByEmail(@Param("email") String email);

    CompanyUserDO findByPhoneOrEmail(@Param("phoneOrEmail") String phoneOrEmail);

    List<Long> selectByIdsWithShareLocked(List<Long> idList);
}
